Added manual control of the turret#148
Conversation
| private final CommandXboxController controller; | ||
|
|
||
|
|
||
| public ManualTurretMove(TurretSubsystem subsystem, CommandXboxController controller) { |
There was a problem hiding this comment.
use a supplier instead of passing the controller, similar to what we're doing with the drive joysticks.
|
|
||
| @Override | ||
| public void execute() { | ||
| subsystem.manualMove(controller.getLeftX()/4); |
There was a problem hiding this comment.
make this scaling factor into a constant
| } | ||
| } | ||
| public void manualMove(double input){ | ||
| if((input > 0 && !isAtForwardLimit())||(input < 0 && !isAtReverseLimit())){ |
There was a problem hiding this comment.
We may want to add a max value for turret and a min value and check input against it, just in case a limit switch is broken.
…RC4048/Java_2026 into JW-added-manual-turret-control
| } | ||
| public void manualMove(double input){ | ||
| if((input > 0 && !isAtForwardLimit())||(input < 0 && !isAtReverseLimit()) || (currentSetPosition+input > Constants.TURRET_ENCODER_MAX) || (currentSetPosition+input > Constants.TURRET_ENCODER_MIN)){ | ||
| if(((input > 0 && !isAtForwardLimit())||(input < 0 && !isAtReverseLimit())) && (currentSetPosition+input < Constants.TURRET_ENCODER_MAX) && (currentSetPosition+input > Constants.TURRET_ENCODER_MIN)){ |
There was a problem hiding this comment.
I think this condition is incorrect and that if the switch is not connected, the turret will not move at all. I think an easier way to handle the manual turret control would be to move it at a constant speed in the right direction instead of changing the set point, then there's no need to worry about limit switches or min/max values.
No description provided.